package net.lainiao.morethread.Chapter2.demo1;

/**
 * Created by Administrator on 2017/2/28.
 */
public class Main {
    public static void main(String[] args) {
        Account account=new Account();
        account.setBalance(1000);
        Bank bank=new Bank(account);
        Thread bankThread=new Thread(bank);
        Company company=new Company(account);
        Thread compThread=new Thread(company);
        System.out.println("Account:Initial Balance :"+account.getBalance());
        bankThread.start();
        compThread.start();;
        try {
            bankThread.join();
            compThread.join();
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        System.out.println("Account: Final Balance :"+account.getBalance());

    }
}
